home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / libs / conlib.lha / ConLib / Asm_Stuff / Hello.asm < prev   
Assembly Source File  |  1992-01-04  |  3KB  |  155 lines

  1. ;==================================================================
  2. ;===
  3. ;===    Name:    Hello
  4. ;===
  5. ;===    Author:    Bjørn Reese
  6. ;===
  7. ;===    This source is Public Domain.
  8. ;===
  9. ;==================================================================
  10.  
  11. ;--- Comment ------------------------------------------------------
  12. ;
  13. ; TAB = 8    ;    POINTER = ^
  14. ;
  15. ; A simple example of how to use "con.library".
  16. ;
  17. ;------------------------------------------------------------------
  18.  
  19.  
  20. ;--- System -------------------------------------------------------
  21.  
  22.     INCDIR    INCLUDE:
  23.  
  24. ;--- Include ------------------------------------------------------
  25.  
  26.     INCLUDE    exec/exec_lib.i
  27.     INCLUDE    intuition/intuition.i
  28.     INCLUDE    work/con_lib.i        ;or whereever you keep them.
  29.     INCLUDE    work/con.i
  30.  
  31. ;--- Macro --------------------------------------------------------
  32.  
  33. CALL:    MACRO
  34.     jsr    _LVO\1(a6)
  35.     ENDM
  36.  
  37.  
  38. ;==================================================================
  39. ;===
  40. ;===    CODE AREA
  41. ;===
  42. ;==================================================================
  43.  
  44.     SECTION    Reese,CODE
  45.  
  46. start:
  47.  
  48. ;--- Open Con Library
  49.  
  50.     move.l    (_SysBase).w,a6
  51.     moveq    #0,d0
  52.     lea    sConName(pc),a1
  53.     CALL    OpenLibrary
  54.     move.l    d0,pConBase
  55.  
  56. ;--- Open ConWindow (with cursor off)
  57.  
  58.     move.l    pConBase(pc),a6
  59.     lea    dMyWindow(pc),a0
  60.     move.w    #CURSOROFF,d0
  61.     CALL    OpenCon
  62.     move.l    d0,pConHandle
  63.  
  64. ;--- Place the cursor
  65.  
  66.     move.l    pConHandle(pc),a0
  67.     moveq    #30,d0
  68.     moveq    #12,d1
  69.     CALL    GotoXY
  70.  
  71. ;--- Write a text
  72.  
  73.     moveq    #-1,d0
  74.     move.l    pConHandle(pc),a0
  75.     lea    sHello(pc),a1
  76.     CALL    DisplayRaw
  77.  
  78. ;--- Wait for keypressed
  79.  
  80.     move.l    pConHandle(pc),a0
  81.     move.l    #ACCF_WAIT!ACCF_ECHO!ACCF_ERASE,d0
  82.     lea    dKeypress(pc),a1
  83.     CALL    Accept
  84.  
  85. ;--- Close ConWindow
  86.  
  87.     move.l    pConBase(pc),a6
  88.     move.l    pConHandle(pc),a0
  89.     CALL    CloseCon
  90.  
  91. ;--- Close Con Library
  92.  
  93.     move.l    (_SysBase).w,a6
  94.     move.l    pConBase(pc),a1
  95.     CALL    CloseLibrary
  96.     moveq    #0,d0
  97.     rts
  98.  
  99.  
  100. ;==================================================================
  101. ;===
  102. ;===    DATA AREA
  103. ;===
  104. ;==================================================================
  105.  
  106. DataArea:
  107.  
  108. ;--- Variable -----------------------------------------------------
  109.  
  110. pConBase    dc.l    0
  111. pConHandle    dc.l    0
  112.  
  113. ;--- Text ---------------------------------------------------------
  114.  
  115. sConName    dc.b    'con.library',0
  116. sWindowTitle    dc.b    '- Press any key -',0
  117.  
  118. sHello        dc.b    'Hello Amiga dudes.',0
  119.     EVEN
  120.  
  121.  
  122. ;--- Table --------------------------------------------------------
  123.  
  124. cMyIDCMP    SET CLOSEWINDOW
  125. cMyFlags    SET WINDOWSIZING!WINDOWDRAG!WINDOWDEPTH!WINDOWCLOSE
  126. cMyFlags    SET cMyFlags!SMART_REFRESH!ACTIVATE!NOCAREREFRESH
  127.  
  128. ;--- Intuition NewWindow Structure
  129.  
  130. dMyWindow:
  131.     dc.w    0,11        ;LeftEdge, TopEdge
  132.     dc.w    640,245        ;Width, Height
  133.     dc.b    0,1        ;DetailPen, BlockPen
  134.     dc.l    cMyIDCMP    ;IDCMPFlags
  135.     dc.l    cMyFlags    ;Flags
  136.     dc.l    0,0        ;FirstGadget, CheckMark
  137.     dc.l    sWindowTitle    ;Title
  138.     dc.l    0        ;Screen
  139.     dc.l    0        ;BitMap
  140.     dc.w    30,30        ;MinWidth, MinHeight
  141.     dc.w    -1,-1        ;MaxWidth, MaxHeight
  142.     dc.w    WBENCHSCREEN    ;Type
  143.  
  144. ;--- AcceptStruct
  145.  
  146. dKeypress:
  147.     dc.w    -1,-1            ;XStart,YStart
  148.     dc.w    -1,-1,-1        ;Styles,FgCol,BgCol
  149.     dc.l    CLOSEWINDOW        ;ExitFlags
  150.     dcb.l    7,0            ;Message stuff
  151.     dc.b    0,0            ;Char,Pad001
  152.     dcb.b    CHARDEFSIZE,-1        ;ValidTable
  153.     dcb.b    CHARDEFSIZE,-1        ;ExitTable
  154.     dcb.l    4,0            ;Reserved
  155.